package com.example.dmc_android_sellbreakfast_ver1;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class OpenHelper extends SQLiteOpenHelper {
	static String DB_NAME = "khachhang";
	static int DB_VERSION = 1;

	static String TB_NAME = "khachhang";
	static String COLUMN_ID = "id";
	static String COLUMN_NAME = "name";
	static String COLUMN_USER = "user";
	static String COLUMN_PW = "password";
	static String COLUMN_ROOM = "room";

	public OpenHelper(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		String Create = "CREATE TABLE " + TB_NAME + " (" + COLUMN_ID
				+ " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_USER
				+ " TEXT NOT NULL," + COLUMN_PW + " TEXT NOT NULL,"
				+ COLUMN_NAME + " TEXT NOT NULL," + COLUMN_ROOM
				+ " TEXT NOT NULL );";

		db.execSQL(Create);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		String sql = "DROP TABLE IF EXITS " + TB_NAME;
		onCreate(db);
	}

}
